Skip to content

West Midlands | ITP-MAY25 | Saleh Yousef | Module-Data-Groups | Sprint-2 #622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SalehOmar-Y
Copy link

@SalehOmar-Y SalehOmar-Y commented Jul 16, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.
This PR implements and tests functions: createLookup, parseQueryString, tally, and invert.
Includes bug fixes, edge case handling, and validation with unit tests.

Questions

Ask any questions you have for your reviewer.

@SalehOmar-Y SalehOmar-Y added Needs Review Participant to add when requesting review 📅 Sprint 2 Assigned during Sprint 2 of this module labels Jul 16, 2025
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

@@ -11,5 +11,7 @@ const recipe = {
};

console.log(`${recipe.title} serves ${recipe.serves}
ingredients:
${recipe}`);
ingredients:`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor query here shouldn't the console read out "bruschetta serves 2, the ingredients are: ". Your code reads "bruschetta serves 2 ingredients: ". Otherwise this works

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both tests pass - well done

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests passed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test passed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code works however do some further research on how this could be improved. For example dealing with URL encoded string(decodeURIComponent). Then you could write a test to see if your solution works.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests passed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code works for tests. Do some further research on how code could be improved to handle edge cases such as undefined values.

@fearcyf fearcyf self-assigned this Jul 17, 2025
@fearcyf fearcyf added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 17, 2025
Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally looking really good, just one thing to pick up :)

Comment on lines +9 to +10
const [key, ...rest] = pair.split("=");
queryParams[key] = rest.join("=");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you fixed a bug here but didn't write a test for it - can you add a test for the edge case you fixed?

Comment on lines +13 to +26

test("parses querystring with multiple values", () => {
expect(parseQueryString("name=John&age=30")).toEqual({
"name": "John",
"age": "30",
});
});
test("parses querystring with multiple values with same key", () => {
expect(parseQueryString("name=John&name=Jane")).toEqual({
"name": "Jane", // Last value should overwrite previous ones
});
});

test("parses querystring without key", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good edge cases!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reviewed Volunteer to add when completing a review 📅 Sprint 2 Assigned during Sprint 2 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants